package gjbsh.bangong.ds.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import gjbsh.bangong.ds.service.权限用户角色Service;
import gjbsh.support.JsonResult;

/**
 * @author yaolongjun
 * @date   2020年5月21日 下午3:43:19
 */
@RestController
@RequestMapping("quanxian_yonghu_juese")
public class 权限用户角色Controller {
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	权限用户角色Service ddService;
	
	/**
	 * @author yaolongjun
	 * @description	设置领导账号 
	 */
	@RequestMapping("set_admin_account")
	public JsonResult<?> set_admin_account(@RequestParam("userid")String ppUserId,
			@RequestParam("value")int ppValue){
		try {
			if("".equals(ppUserId)) {
				return JsonResult.getErrorResult("用户ID不能为空");
			}
			
			if(!ddService.setAdminAccount(ppUserId,ppValue)) {
				return JsonResult.getErrorResult("设置领导账号失败");
			}
			return JsonResult.getSuccessResult("设置领导账号成功");
		} catch (Exception e) {
			logger.error("权限用户角色Controller->set_admin_account: "+e.getMessage());
			return JsonResult.getErrorResult("设置领导账号失败");
		}
	}

}
